/*
 * Created on Feb 25, 2005
 */
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import javax.swing.*;
/**
 * @author Jesse Phillips
 */
public class MouseTracker implements MouseListener, MouseMotionListener {
	private Timer myTimer;
	private DrawMe objDraw;
	private Objects myObj;
	private int startX, startY;
	private Timer ballRate;
	
	public MouseTracker(Timer t) {
	    myTimer = t;
	}
	
	public MouseTracker(DrawMe d, Timer b) {
		objDraw = d;
		ballRate = b;
	}
	
	/*
	 *  Mouse Listener events
	 *  Implement this method
	 */
	public void mousePressed(MouseEvent e){
		/*ans bl*/
	    myObj = new Objects(e.getX(), e.getY(), 50, 50, "circle", true, objDraw);
	    startX = e.getX();
	    startY = e.getY();
		 /*ans ab*/
	}
	
	public void mouseReleased(MouseEvent e) {
		myObj.start((startX - e.getX())/3, (startY - e.getY())/3);
	}
	
	public void mouseClicked(MouseEvent e) {
		if(ballRate.isRunning()) {
			ballRate.stop();
		}else {
			ballRate.start();
		}
	}
	
	public void mouseEntered(MouseEvent e) {
		
	}
	
	public void mouseExited(MouseEvent e) {
		
	}
	/*
	 * Mouse Motion listener events
	 */
	public void mouseDragged(MouseEvent e) {
		
	}
	
	public void mouseMoved(MouseEvent e) {
	    
	}
}
